package com.bianguo.android.assemblydemo.view.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.bianguo.android.assemblydemo.R;
import com.bianguo.android.componentlib.ServiceFactory;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private Button loginBtn, mineBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initView();
        setListener();
    }

    private void initView() {
        loginBtn = findViewById(R.id.main_login_btn);
        mineBtn = findViewById(R.id.main_mine_btn);
    }

    private void setListener() {
        loginBtn.setOnClickListener(this);
        mineBtn.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.main_login_btn:
                ServiceFactory.getInstance().getLoginService().lunch(this, null);
                break;
            case R.id.main_mine_btn:
                ServiceFactory.getInstance().getMineService().lunch(this, 222);
                break;
        }
    }
}
